home *** CD-ROM | disk | FTP | other *** search
/ Multimedia World History / Multimedia World History (USA).7z / MMWH.bin / title.mst < prev    next >
Text File  |  1994-09-15  |  18KB  |  509 lines

  1. '**************************************************************************
  2. '*
  3. '* TITLE.MST - Viewer Runtime Setup Script
  4. '*
  5. '* CUSTOMIZING TITLE.MST
  6. '*
  7. '* For a simple Setup routine, you just need to assign values to the 
  8. '* series of variables following the heading "Setup Variables". This
  9. '* script also provides for the following more-advanced options, which
  10. '* are supported by subroutines located later in this script:
  11. '*
  12. '* Option                                         See Subroutine
  13. '* ------------------------------------------     ---------------------
  14. '* Install more than one .MVB file                ModifyViewerIni
  15. '* Install Help title                             ModifyViewerIni
  16. '* Install custom DLLs                            ModifyViewerIni
  17. '* Install multiple Program Manager items         ModifyProgramManager
  18. '* Display a custom icon with the ProgMan item    ModifyProgramManager
  19. '* Install custom fonts                           RegisterCustomFonts
  20. '* Install Video for Windows runtime files        RegisterDrivers
  21. '*
  22. '* Each customization note starts with the heading CUSTOMIZATION.
  23. '*
  24. '**************************************************************************
  25.     
  26.     '' Global variables
  27.  
  28.     GLOBAL TitleShortName$
  29.     GLOBAL TitleLongName$
  30.     GLOBAL MVBFileName$
  31.     GLOBAL PromptForPath%
  32.     GLOBAL DefaultPath$
  33.     GLOBAL ProgManGroup$
  34.     GLOBAL ProgManItem$
  35.  
  36.     '' ****************************************************************
  37.     '' ** Setup Variables
  38.     '' ****************************************************************
  39.  
  40.     '' Set the following string to a short form of the title name
  41.     '' (for example, "Gallery")
  42.     
  43.     TitleShortName$ = "Multimedia World History"
  44.     
  45.     '' Set the following string to a long form of the title name
  46.     '' (for example, "Viewer 2.0 Gallery")
  47.     
  48.     TitleLongName$ = "Multimedia World History"
  49.         
  50.     '' Set the following variable to the name of the MVB file, without 
  51.     '' the filename extension (for example, "GALLERY")
  52.         
  53.     MVBFileName$ = "mwh"
  54.         
  55.     '' The following variable determines whether Setup prompts the user
  56.     '' to specify a directory in which to install title files. (Files
  57.     '' to be installed on the hard disk must be listed in the TITLE.INF 
  58.     '' file under the [Installed Title Files] section.) Specify one of
  59.     '' the following values:
  60.     ''
  61.     '' 0    Install title files in the Windows directory (default setting).
  62.     ''      This is an appropriate setting if you have a limited number
  63.     ''      of files to copy (for example, a single custom icon or DLL).
  64.     ''
  65.     '' 1    Display a dialog box to prompt the user for a directory in 
  66.     ''      which to install files
  67.         
  68.     PromptForPath% = 1
  69.         
  70.     '' If you have specified 1 in PromptForPath%, set the following 
  71.     '' variable to the default path that will be displayed in the dialog
  72.     '' box (for example, "C:\GALLERY").
  73.         
  74.     DefaultPath$ = "C:\MMWH"
  75.     
  76.     '' Set the following variable to the name of the program manager 
  77.     '' group you would like to create (for example, "Viewer 2.0 Gallery")
  78.         
  79.     ProgManGroup$ = "Bureau Multimedia"
  80.     
  81.     '' Set the following variable to the caption of the program manager 
  82.     '' item for your title (for example, "Gallery")
  83.         
  84.     ProgManItem$ = "Multimedia World History"
  85.     
  86.     '***********************************************************************
  87.     '** Mainline
  88.     '***********************************************************************
  89.  
  90.     GLOBAL CUIDLL$
  91.  
  92.     '' Include files
  93.     '$INCLUDE 'setupapi.inc'
  94.     
  95.     '' Custom UI dll
  96.     CUIDLL$ = "mscuistf.dll"
  97.     
  98.     '' Dialog ID's
  99.     CONST DESTPATH      = 1000
  100.     CONST APPHELP       = 2000
  101.     CONST TOOBIG        = 3000
  102.     CONST BADPATH       = 4000
  103.     CONST SUCCESS       = 5000
  104.     
  105.     '' Bitmap ID
  106.     CONST LOGO = 1
  107.     
  108.     '' Functions and subroutines
  109.     DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER
  110.     DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  111.     DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
  112.     DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
  113.     DECLARE SUB RegisterFont(fontfile$, fontname$)
  114.     DECLARE SUB ModifyViewerIni(szTitleDir$)
  115.     DECLARE SUB RegisterCustomFonts
  116.     DECLARE SUB ModifyProgramManager
  117.     DECLARE SUB ShowSuccess
  118.     DECLARE SUB RegisterDrivers
  119.     
  120.     '' The following statement turns size checking off. Set it to scmOnFatal 
  121.     '' to enable size checking, where Setup will compare the disk file size 
  122.     '' with the INF file size and report an error if they are not the same.
  123.     
  124.     i% = SetSizeCheckMode(scmOff)
  125.     
  126.     '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to 
  127.     '' alter the banner bitmap.
  128.     
  129.     SetTitle "Bureau Title Setup"
  130.     SetBitmap CUIDLL$, LOGO 
  131.     
  132.     '' Read in the INF file.
  133.     
  134.     ReadInfFile GetSymbolValue("STF_CWDDIR") + "TITLE.INF"
  135.     
  136.     '' Decide where to put title files
  137.     IF PromptForPath% = 1 THEN
  138.         szTitleDir$ = GetTitleDir(DefaultPath$)
  139.         IF szTitleDir$ = "" THEN
  140.             GOTO QUIT
  141.         ENDIF
  142.     ELSE
  143.         szTitleDir$ = GetWindowsDir()
  144.     ENDIF   
  145.     
  146.     '' Copy files
  147.     IF CopyFiles(szTitleDir$) = 0 THEN
  148.         GOTO QUIT
  149.     ENDIF
  150.  
  151.     '' Create the MVIEWER2.EXE MVB association 
  152.     CreateIniKeyValue "WIN.INI", "Extensions", "MVB", "mviewer2.exe", cmoNone
  153.  
  154.     '' Register in VIEWER.INI
  155.     ModifyViewerIni szTitleDir$
  156.  
  157.     '' Register custom fonts
  158.     RegisterCustomFonts
  159.  
  160.     '' Register drivers
  161.     RegisterDrivers
  162.     
  163.     '' Modify Program Manager
  164.     ModifyProgramManager    
  165.     
  166.     '' Success dialog
  167.     ShowSuccess
  168.     
  169.     '' Now start the title
  170.  
  171.     RUN "mviewer2.exe " + MVBFileName$ + ".MVB", NOWAIT
  172.  
  173. QUIT:
  174.     
  175.     END
  176.     
  177.  
  178. '*************************************************************************
  179. '** Purpose:
  180. '**     Prompts the user for a path for the title files
  181. '** Arguments:
  182. '**     szDefault$ - default path
  183. '** Returns:
  184. '**     New valid path name, or "" if the user quit.
  185. '*************************************************************************
  186.  
  187. FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
  188.  
  189.     SetSymbolValue "String", TitleShortName$
  190.     SetSymbolValue "EditTextIn", szDefault$
  191.     SetSymbolValue "EditFocus", "ALL"
  192.  
  193.     GETPATH:
  194.  
  195.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
  196.  
  197.     IF sz$ = "CONTINUE" THEN
  198.         szTitleDir$ = GetSymbolValue("EditTextOut")
  199.         IF IsDirWritable(szTitleDir$) = 0 THEN
  200.  
  201.             BADPATH:
  202.  
  203.             sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "")
  204.             IF sz$ = "REACTIVATE" THEN
  205.                 GOTO BADPATH
  206.             END IF
  207.             UIPop 1
  208.             GOTO GETPATH
  209.         END IF
  210.         UIPop 1
  211.         CreateDir szTitleDir$, cmoNone
  212.  
  213.     ELSEIF sz$ = "REACTIVATE" THEN
  214.         GOTO GETPATH
  215.  
  216.     ELSE
  217.         szTitleDir$ = ""
  218.  
  219.     END IF
  220.  
  221.     GetTitleDir = szTitleDir$
  222.  
  223. END FUNCTION
  224.  
  225.  
  226. '*************************************************************************
  227. '** Purpose:
  228. '**     Copies the files in the INF file
  229. '** Arguments:
  230. '**     szTitleDir$ - destination directory for the title files
  231. '** Returns
  232. '**     1 if files were copied, 0 otherwise
  233. '*************************************************************************
  234.  
  235. FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
  236.  
  237.     '' Add all system files to the copy list
  238.     AddSectionFilesToCopyList "System Files", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir()    
  239.     '' Add all of the title files to the copy list
  240.     AddSectionFilesToCopyList "Installed Title Files", GetSymbolValue("STF_SRCDIR"), szTitleDir$
  241.     
  242.     '' Check size
  243.     szExtras$ = "Extra"
  244.     szCosts$ = "Costs"
  245.     szNeededs$ = "Neededs"
  246.     FOR i% = 1 TO 26 STEP 1
  247.         AddListItem szExtras$, "0"
  248.     NEXT i%
  249.     
  250.     '' We assume that VIEWER.INI will take another 4K
  251.     ReplaceListItem szExtras$, ASC(MID$(GetWindowsDir(), 1, 1)) - ASC("A") + 1, STR$(4096)
  252.     
  253.     '' Get amount of space required
  254.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  255.     
  256.     '' Put up a message if there is not enough space
  257.     FOR i% = 1 TO 26 STEP 1
  258.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  259.     
  260.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  261.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  262.     
  263.             TOOBIG:
  264.     
  265.             sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
  266.             IF sz$ = "REACTIVATE" THEN
  267.                 GOTO TOOBIG
  268.             END IF
  269.             UIPop 1
  270.             CopyFiles = 0
  271.             GOTO DONTCOPY
  272.         END IF
  273.     NEXT i%
  274.     
  275.     '' Copy the files
  276.     CopyFilesInCopyList
  277.     
  278.     CopyFiles = 1
  279.  
  280. DONTCOPY:
  281.  
  282. END FUNCTION
  283.  
  284.  
  285. '*************************************************************************
  286. '** Purpose:
  287. '**     Puts up a success dialog
  288. '*************************************************************************
  289.  
  290. SUB ShowSuccess STATIC
  291.  
  292.     SUCCESS:
  293.     
  294.     SetSymbolValue "String1", TitleShortName$
  295.     sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FInfoDlgProc", 0, "")
  296.     IF sz$ = "REACTIVATE" THEN
  297.         GOTO SUCCESS
  298.     END IF
  299.     UIPop 1
  300.     
  301. END SUB
  302.  
  303.  
  304. '*************************************************************************
  305. '** Purpose:
  306. '**     Appends a file name to the end of a directory path,
  307. '**     inserting a backslash character as needed.
  308. '** Arguments:
  309. '**     szDir$  - full directory path (with optional ending "\")
  310. '**     szFile$ - filename to append to directory
  311. '** Returns:
  312. '**     Resulting fully qualified path name.
  313. '*************************************************************************
  314.  
  315. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  316.     IF szDir$ = "" THEN
  317.         MakePath = szFile$
  318.     ELSEIF szFile$ = "" THEN
  319.         MakePath = szDir$
  320.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  321.         MakePath = szDir$ + szFile$
  322.     ELSE
  323.         MakePath = szDir$ + "\" + szFile$
  324.     END IF
  325. END FUNCTION
  326.  
  327.  
  328. '*************************************************************************
  329. '** Purpose:
  330. '**     Registers a font.
  331. '** Arguments:
  332. '**     fontfile$ - font filename
  333. '**     fontname$ - font name.
  334. '*************************************************************************
  335.  
  336. SUB RegisterFont(fontfile$, fontname$) STATIC
  337.  
  338.     '' A simple error catching wrapper around AddFont, which is a 'C' routine in MSCUISTF.DLL
  339.  
  340.    IF AddFont(fontfile$, fontname$) = -1 THEN
  341.         j% = DoMsgBox("This font is already installed " + fontfile$ + " font.", "Viewer Font Installation", 0)
  342.    ENDIF
  343.  
  344. END SUB
  345.  
  346.  
  347. '*************************************************************************
  348. '** Purpose:
  349. '**     Registers title in VIEWER.INI
  350. '*************************************************************************
  351.  
  352. SUB ModifyViewerIni (szTitleDir$) STATIC
  353.  
  354.     '' Get the VIEWER.INI file
  355.     
  356.     szIni$ = MakePath(GetWindowsDir(), "VIEWER.INI")
  357.  
  358.     '' First register the title file, setting the Name and Path entries. 
  359.     '' We assume that the MVB file is the same directory as SETUP.EXE.
  360.     ''
  361.     '' CUSTOMIZATION: If you're installing multiple MVB files, copy the
  362.     '' following two statements for each additional file, substituting
  363.     '' the appropriate long name and MVB filename for the TitleLongName$
  364.     '' and MVBFileName$ variables.
  365.     
  366.     CreateIniKeyValue szIni$, MVBFileName$, "Name", TitleLongName$, cmoOverwrite
  367.     CreateIniKeyValue szIni$, MVBFileName$, "Path", GetSymbolValue("STF_SRCDIR"), cmoOverwrite
  368.  
  369.     CreateIniKeyValue szIni$, "MWHHELP.MVB", "Name", "Multimedia World History Help", cmoOverwrite
  370.     CreateIniKeyValue szIni$, "MWHHELP.MVB", "Path", GetSymbolValue("STF_SRCDIR"), cmoOverwrite
  371.     CreateIniKeyValue szIni$, "TOUR-SEARCH DIALOG HELP", "MWH", "JumpID(`mwh.mvb>w_help',`search_help')", cmoOverwrite
  372.     CreateIniKeyValue szIni$, "TOUR-SEARCH DIALOG TOURS", "Small Tour", "mmtour1", cmoOverwrite
  373.     CreateIniKeyValue szIni$, "TOUR-SEARCH DIALOG TOURS", "Medium Tour", "mmtour2", cmoOverwrite
  374.     CreateIniKeyValue szIni$, "TOUR-SEARCH DIALOG TOURS", "Large Tour", "mmtour3", cmoOverwrite
  375.     
  376.   
  377.     '' Now we have to register the MVB file in the [FILES] section, so 
  378.     '' Viewer can find files that are not on the path and display a 
  379.     '' special message when a file is not found.
  380.  
  381.     CreateIniKeyValue szIni$, "FILES", MVBFileName$ + ".MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the " + TitleLongName$ + " disk.", cmoOverwrite
  382.     
  383.     CreateIniKeyValue szIni$, "FILES","MWHHELP.MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the " + TitleLongName$ + " disk.", cmoOverwrite
  384.  
  385.  
  386.  
  387.     '' CUSTOMIZATION: If you're installing a Help title or any custom DLLs,
  388.     '' you should copy the preceding statement for each extra title or DLL.    ''
  389.     '' Example for installing an extra title:
  390.     ''
  391.      '' CreateIniKeyValue szIni$, "FILES", "GALHELP.MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the Viewer 2.0 Gallery disk.", cmoOverwrite
  392.     ''
  393.     '' Example for installing a custom DLL:
  394.          CreateIniKeyValue szIni$, "FILES", "LAUNCHEX.DLL", szTitleDir$ + "\," + "A required file is missing. Please reinstall Multimedia World History.", cmoOverwrite
  395.  
  396.          CreateIniKeyValue szIni$, "FILES", "TIMELINE.EXE", szTitleDir$ + "\," + "A required file is missing. Please reinstall Multimedia World History.", cmoOverwrite
  397.  
  398.          CreateIniKeyValue szIni$, "FILES", "TOURSRCH.DLL", szTitleDir$ + "\," + "A required file is missing. Please reinstall Multimedia World History.", cmoOverwrite
  399.  
  400.          CreateIniKeyValue szIni$, "FILES", "EPLIST.DLL", szTitleDir$ + "\," + "A required file is missing. Please reinstall Multimedia World History.", cmoOverwrite
  401.  
  402.          CreateIniKeyValue szIni$, "FILES", "NETCHECK.DLL", szTitleDir$ + "\," + "A required file is missing. Please reinstall Multimedia World History.", cmoOverwrite
  403.     
  404. END SUB
  405.  
  406.  
  407. '*************************************************************************
  408. '** Purpose:
  409. '**     Creates program manager entries for the title
  410. '*************************************************************************
  411.  
  412. SUB ModifyProgramManager STATIC
  413.  
  414.     '' Create the program manager group
  415.  
  416.     CreateProgmanGroup ProgmanGroup$, "", cmoNone
  417.     ShowProgmanGroup ProgmanGroup$, 1, cmoNone
  418.     
  419.     '' Create an entry for the title
  420.      
  421.     CreateProgmanItem ProgmanGroup$, ProgmanItem$, "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".MVB"), MakePath(GetSymbolValue("STF_SRCDIR"), "bureau.ico"), cmoOverwrite
  422.  
  423.     CreateProgmanItem ProgmanGroup$, "Multimedia World History Help", "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), "MWHHELP.MVB"), MakePath(GetSymbolValue("STF_SRCDIR"), "MWH.ICO"), cmoOverwrite
  424.     CreateProgmanItem ProgmanGroup$, "Multimedia World History", "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), "MWH.MVB"), MakePath(GetSymbolValue("STF_SRCDIR"), "MWH.ICO"), cmoOverwrite    
  425.     '' CUSTOMIZATION: 
  426.     ''
  427.     '' To create additional Program Manager items, copy the preceding 
  428.     '' statement for each additional item, substituting the appropriate
  429.     '' Program Manager item name for ProgmanItem$ and filename for 
  430.     '' MVBFileName$.
  431.     ''
  432.     '' To display a custom icon with the Program Manager item, specify
  433.     '' the icon filename with the fourth parameter (this parameter is 
  434.     '' currently an empty string, ""). The following example specifies 
  435.     '' an icon with the same filename as the .MVB file:
  436.     ''
  437.     ''       CreateProgmanItem ProgmanGroup$, ProgmanItem$, "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".MVB"), MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".ICO"), cmoOverwrite
  438.  
  439.  
  440. END SUB
  441.  
  442.  
  443. '*************************************************************************
  444. '** Purpose:
  445. '**     Registers custom fonts with Windows.
  446. '*************************************************************************
  447.  
  448. SUB RegisterCustomFonts STATIC
  449.  
  450.     '' CUSTOMIZATION: If you install custom fonts, then add statements
  451.     '' in this routine to register the fonts with the current Windows 
  452.     '' session and to add them to the WIN.INI [Fonts] section. 
  453.     ''
  454.     '' Note that TrueType fonts can only be installed in Windows 3.1.
  455.     '' RegisterFont automatically creates the required .FOT file for 
  456.     '' TrueType fonts.
  457.     ''    
  458.     '' The following example registers a font residing in MISTRAL.TTF
  459.     '' and installs the font with the name Mistral (True Type):
  460.     '' 
  461.     RegisterFont "avalonn.ttf","Avalon (TrueType)"
  462.      RegisterFont "bahamasn.ttf","Bahamas (TrueType)"
  463.     RegisterFont "switzn.ttf","Switzerland (TrueType)"
  464.     RegisterFont "palmsprn.ttf","PalmSprings (TrueType)"
  465.     RegisterFont "techncln.ttf","Technical (TrueType)"
  466.     RegisterFont "voguen.ttf","Vogue (TrueType)"
  467.     RegisterFont "zurichi.ttf","Zurich Calligraphic (TrueType)"
  468.     RegisterFont "gatinean.ttf","Gatineau (TrueType)"
  469.     ''
  470.  
  471. END SUB
  472.  
  473.  
  474. '*************************************************************************
  475. '** Purpose:
  476. '**     Registers Windows drivers
  477. '*************************************************************************
  478.  
  479. SUB RegisterDrivers STATIC
  480.  
  481. '' CUSTOMIZATION: Video for Windows is not a standard component of
  482. '' Windows 3.1. If your title uses video, proceed as follows.
  483. ''
  484. '' 1) Add the following files to the [System Files] section of the INF file:
  485. ''
  486. ''    dispdib.dll
  487. ''    msvideo.dll
  488. ''    indeo.drv
  489. ''    mciavi.drv
  490. ''    msvidc.drv
  491. ''
  492. '' 2) Add the above files to your release directory. US versions can be 
  493. ''    found in the \SYSTEM subdirectory of your Viewer disc. French and
  494. ''    German versions were not available at ship time. Please contact 
  495. ''    Microsoft or check the Multimedia Viewer section on the Microsoft
  496. ''    Compuserve Forum for further details.
  497. ''
  498. '' 3) Uncomment the following lines:
  499. ''
  500.  CreateIniKeyValue "WIN.INI", "mci extensions", "AVI", "AVIVIDEO", cmoNone
  501.  CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "mci", "AVIVIDEO", "MCIAVI.DRV", cmoNone
  502.  CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.msvc", "msvidc.drv", cmoNone
  503.  CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.rt21", "indeo.drv", cmoNone
  504.  
  505. END SUB
  506.  
  507.  
  508.  
  509.